package cn.leestudio.springboot.config;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;

import javax.sql.DataSource;

/**
 * Created by Administrator on 2018/3/6.
 */
@Configuration
public class DBConfig {

    @Bean(name = "study")
    @ConfigurationProperties(prefix = "spring.datasource.study") // application.properteis中对应属性的前缀
    public DataSource dataSource1() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "leestudio")
    @ConfigurationProperties(prefix = "spring.datasource.leestudio") // application.properteis中对应属性的前缀
    public DataSource dataSource2() {
        return DataSourceBuilder.create().build();
    }

    @Bean(name = "full")
    @ConfigurationProperties(prefix = "spring.datasource.full") // application.properteis中对应属性的前缀
    public DataSource dataSourceFull() {
        return DataSourceBuilder.create().build();
    }

}
